#ifndef _2020_H_
#define _2020_H_

#include "H/Function_Init.H"
#include "H/GPIO.H"
#include "H/DELAY.H"

/***********************************************************************************************
全局变量定义  
***********************************************************************************************/
#define   SDA_IN      P0OE3_IN  
#define   SCL_IN      P0OE4_IN
#define   SDA_OUT     P0OE3_OUT  
#define   SCL_OUT     P0OE4_OUT   
#define   SDA         P03
#define   SCL         P04
#define   M_ACK       0
#define   M_NACK      1
#define   M_SET       1
#define   FAIL        0
#define   TRUE        1
#define   M_FAIL      0
#define   M_TRUE      1
#define   MR_FAIL     0x100
#define   RD_FAIL     MR_FAIL

//#define PT2020_Sens_Reset                    0xBB  	
//#define PT2020_Sens_User                     0x33 	
#define PT2020_ID_SEL_Address                0xF0   	//VDD
/***********************************************************************************************
函数声明   
***********************************************************************************************/
unsigned int PT2020_I2C_ReadData(unsigned char regAdd);
bit PT2020_I2C_WriteData(unsigned char regAdd,unsigned char u8_data);
void PT2020_I2C_Start();
void PT2020_I2C_Stop();
void PT2020_I2C_MasterSendAck(bit isAck);
void PT2020_I2C_WriteByte(unsigned char u8_data);
bit PT2020_I2C_SlaveAck();
unsigned char PT2020_I2C_ReadByte();
bit PT2020_I2C_WaitCLKAR();
bit PT2020_I2C_WaitCLKAW(unsigned char u8_data);
bit PT2020_I2C_ContWriteData(unsigned char regAdd,unsigned char code *P,unsigned char R_L);
void PT2020_I2C_ContReadData(unsigned char regAdd,unsigned int *P,unsigned char R_L);

#endif